<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JAR包工具集</title>
    <!-- 引入Tailwind CSS（本地版本，支持内网环境） -->
    <script src="/static/tailwind.min.js"></script>
    <!-- 引入Font Awesome -->
    <link href="/static/css/font-awesome.min.css" rel="stylesheet">
    
    <!-- 配置Tailwind主题 -->
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#3B82F6',
                        secondary: '#10B981',
                        accent: '#8B5CF6',
                        neutral: '#6B7280',
                        dark: '#1F2937',
                    },
                    fontFamily: {
                        inter: ['Inter', 'system-ui', 'sans-serif'],
                    },
                }
            }
        }
    </script>
    
    <!-- 自定义工具类 -->
    <style type="text/tailwindcss">
        @layer utilities {
            .content-auto {
                content-visibility: auto;
            }
            .glass-effect {
                @apply bg-white/80 backdrop-blur-md border border-gray-200 shadow-sm;
            }
            .card-hover {
                @apply transition-all duration-300 hover:shadow-lg hover:-translate-y-1;
            }
            .btn-primary {
                @apply bg-primary text-white font-medium py-2 px-6 rounded-lg shadow transition-all duration-300 hover:bg-primary/90 hover:shadow-md focus:outline-none focus:ring-2 focus:ring-primary/50 focus:ring-offset-2;
            }
            .form-input {
                @apply w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary/50 focus:border-primary transition duration-300;
            }
            .progress-shine {
                position: relative;
                overflow: hidden;
            }
            .progress-shine::after {
                content: '';
                position: absolute;
                top: 0;
                left: -100%;
                width: 100%;
                height: 100%;
                background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
                animation: shine 2s infinite;
            }
            @keyframes shine {
                100% { left: 100%; }
            }
            /* 确保sr-only类正确定义 */
            .sr-only {
                position: absolute !important;
                width: 1px !important;
                height: 1px !important;
                padding: 0 !important;
                margin: -1px !important;
                overflow: hidden !important;
                clip: rect(0, 0, 0, 0) !important;
                white-space: nowrap !important;
                border-width: 0 !important;
            }
        }
    </style>
</head>
<body class="font-inter bg-gradient-to-br from-blue-50 to-indigo-50 min-h-screen">
    <div class="container mx-auto px-4 py-10 max-w-4xl">
        <!-- 页面标题和描述 -->
        <header class="text-center mb-8">
            <div class="inline-block p-3 bg-primary/10 rounded-full mb-4">
                <i class="fa fa-cube text-primary text-4xl"></i>
            </div>
            <h1 class="text-[clamp(1.8rem,5vw,2.8rem)] font-bold text-dark mb-3">JAR包工具集</h1>
            <p class="text-neutral max-w-2xl mx-auto">高效地更新和管理JAR包文件，支持批量替换、配置文件导入、Class路径匹配、JAR包对比和补丁检查</p>
        </header>
        
        <!-- 功能标签页 -->
        <div class="mb-8 flex justify-center space-x-4 border-b border-gray-200">
            <button id="tab-update" class="tab-btn active px-6 py-3 text-lg font-medium text-primary border-b-2 border-primary transition-all duration-300">
                <i class="fa fa-refresh mr-2"></i>JAR包更新
            </button>
            <button id="tab-match" class="tab-btn px-6 py-3 text-lg font-medium text-neutral hover:text-primary transition-all duration-300">
                <i class="fa fa-search mr-2"></i>Class路径匹配
            </button>
            <button id="tab-compare" class="tab-btn px-6 py-3 text-lg font-medium text-neutral hover:text-primary transition-all duration-300">
                <i class="fa fa-exchange mr-2"></i>JAR包对比
            </button>
            <button id="tab-patch-check" class="tab-btn px-6 py-3 text-lg font-medium text-neutral hover:text-primary transition-all duration-300">
                <i class="fa fa-check-circle mr-2"></i>补丁检查
            </button>
        </div>
        
        <!-- JAR包更新功能区域 -->
        <div id="update-section" class="function-section">
        <!-- 主内容卡片 -->
        <div id="upload-card" class="glass-effect rounded-2xl shadow-lg p-6 md:p-8 mb-8 transition-all duration-500">
            <!-- 上传表单 -->
            <form id="update-form" class="space-y-6">
                <!-- 可折叠的标题栏 -->
                <div class="flex justify-between items-center mb-6 pb-2 border-b">
                    <h2 class="text-xl font-semibold text-dark">文件上传</h2>
                    <button type="button" id="toggle-upload" class="text-neutral hover:text-primary transition duration-300 hidden">
                        <i class="fa fa-chevron-down text-lg"></i>
                    </button>
                </div>
                
                <!-- 可收缩的表单内容 -->
                <div id="upload-form-content" class="space-y-6 transition-all duration-500 overflow-hidden" style="max-height: 2000px; opacity: 1;">
                    <!-- JAR包上传 -->
                <div class="space-y-2">
                    <label for="jar_file" class="block text-sm font-medium text-gray-700">
                        <i class="fa fa-file-archive-o mr-2 text-primary"></i>选择JAR包
                        <span class="text-red-500">*</span>
                    </label>
                    <div class="relative">
                        <input 
                            type="file" 
                            id="jar_file" 
                            name="jar_file" 
                            accept=".jar" 
                            required
                            class="sr-only"
                        >
                        <label for="jar_file" class="flex items-center justify-center w-full h-28 border-2 border-dashed border-gray-300 rounded-lg cursor-pointer bg-gray-50 hover:bg-gray-100 transition duration-300">
                            <div class="text-center">
                                <i class="fa fa-cloud-upload text-3xl text-neutral mb-2"></i>
                                <p class="text-sm text-neutral">点击或拖拽JAR文件至此</p>
                                <p class="text-xs text-gray-500 mt-1">支持 .jar 格式</p>
                            </div>
                        </label>
                        <div id="jar_file_name" class="mt-2 text-sm text-gray-600 hidden"></div>
                    </div>
                </div>
                
                <!-- 替换文件压缩包上传 -->
                <div class="space-y-2">
                    <label for="zip_file" class="block text-sm font-medium text-gray-700">
                        <i class="fa fa-file-zip-o mr-2 text-secondary"></i>选择替换文件压缩包
                        <span class="text-red-500">*</span>
                    </label>
                    <div class="relative">
                        <input 
                            type="file" 
                            id="zip_file" 
                            name="zip_file" 
                            accept=".zip,.rar" 
                            required
                            class="sr-only"
                        >
                        <label for="zip_file" class="flex items-center justify-center w-full h-28 border-2 border-dashed border-gray-300 rounded-lg cursor-pointer bg-gray-50 hover:bg-gray-100 transition duration-300">
                            <div class="text-center">
                                <i class="fa fa-cloud-upload text-3xl text-neutral mb-2"></i>
                                <p class="text-sm text-neutral">点击或拖拽压缩包至此</p>
                                <p class="text-xs text-gray-500 mt-1">支持 .zip, .rar 格式</p>
                            </div>
                        </label>
                        <div id="zip_file_name" class="mt-2 text-sm text-gray-600 hidden"></div>
                    </div>
                </div>
                
                <!-- Excel配置文件上传 -->
                <div class="space-y-2">
                    <label for="excel_file" class="block text-sm font-medium text-gray-700">
                        <i class="fa fa-file-excel-o mr-2 text-accent"></i>选择Excel配置文件
                        <span class="text-red-500">*</span>
                    </label>
                    <div class="relative">
                        <input 
                            type="file" 
                            id="excel_file" 
                            name="excel_file" 
                            accept=".xlsx,.xls" 
                            required
                            class="sr-only"
                        >
                        <label for="excel_file" class="flex items-center justify-center w-full h-28 border-2 border-dashed border-gray-300 rounded-lg cursor-pointer bg-gray-50 hover:bg-gray-100 transition duration-300">
                            <div class="text-center">
                                <i class="fa fa-cloud-upload text-3xl text-neutral mb-2"></i>
                                <p class="text-sm text-neutral">点击或拖拽Excel文件至此</p>
                                <p class="text-xs text-gray-500 mt-1">支持 .xlsx, .xls 格式</p>
                            </div>
                        </label>
                        <div id="excel_file_name" class="mt-2 text-sm text-gray-600 hidden"></div>
                    </div>
                </div>
                </div>
                <!-- 结束可收缩的表单内容 -->
                
                <!-- 提交按钮 -->
                <div class="pt-4 text-center">
                    <button type="submit" id="submit-btn" class="btn-primary">
                        <i class="fa fa-refresh mr-2"></i>开始更新
                    </button>
                </div>
            </form>
        </div>
        
        <!-- 进度显示区域 -->
        <div id="progress-container" class="glass-effect rounded-2xl shadow-lg p-6 md:p-8 mb-8 hidden">
            <h2 class="text-xl font-semibold text-dark mb-6 pb-2 border-b">
                <i class="fa fa-cog fa-spin mr-2 text-primary"></i>更新进度
            </h2>
            
            <!-- 上传进度 -->
            <div class="mb-6">
                <div class="flex justify-between text-sm mb-1">
                    <span class="text-neutral">上传进度</span>
                    <span id="upload-progress-text" class="font-medium text-primary">0%</span>
                </div>
                <div class="h-3 bg-gray-200 rounded-full overflow-hidden">
                    <div 
                        id="upload-progress-bar" 
                        class="h-full bg-primary transition-all duration-300 progress-shine"
                        style="width: 0%;"
                    ></div>
                </div>
                <p id="upload-status" class="text-xs text-neutral mt-2">等待上传...</p>
            </div>

            <!-- 状态信息 -->
            <div class="mb-4">
                <p class="text-sm text-neutral mb-1">当前状态</p>
                <p id="status" class="text-lg font-medium text-dark">准备中...</p>
            </div>
            
            <!-- 进度条 -->
            <div class="mb-2">
                <div class="flex justify-between text-sm mb-1">
                    <span class="text-neutral">进度</span>
                    <span id="progress-text" class="font-medium text-primary">0%</span>
                </div>
                <div class="h-3 bg-gray-200 rounded-full overflow-hidden">
                    <div 
                        id="progress-bar" 
                        class="h-full bg-primary transition-all duration-500 progress-shine"
                        style="width: 0%;"
                    ></div>
                </div>
            </div>
        </div>
        
        <!-- 日志显示区域 -->
        <div id="logs-container" class="glass-effect rounded-2xl shadow-lg p-6 md:p-8 mb-8 hidden">
            <h2 class="text-xl font-semibold text-dark mb-4 pb-2 border-b">
                <i class="fa fa-list-alt mr-2 text-secondary"></i>更新日志
            </h2>
            <div 
                id="logs" 
                class="h-80 overflow-y-auto p-4 bg-gray-50 rounded-lg font-mono text-sm"
                style="line-height: 1.6;"
            ></div>
        </div>
        
        <!-- 下载链接区域 -->
        <div id="download-container" class="glass-effect rounded-2xl shadow-lg p-6 md:p-8 hidden">
            <h2 class="text-xl font-semibold text-dark mb-6 pb-2 border-b">
                <i class="fa fa-check-circle mr-2 text-secondary"></i>更新结果
            </h2>
            
            <div class="space-y-4">
                <div class="card-hover p-4 bg-blue-50 rounded-lg border border-blue-100">
                    <a 
                        id="jar-download" 
                        href="" 
                        class="flex items-center text-primary hover:text-primary/80 transition duration-300"
                        target="_blank"
                    >
                        <i class="fa fa-download text-2xl mr-4"></i>
                        <div>
                            <p class="font-medium">下载更新后的JAR包</p>
                            <p class="text-sm text-neutral mt-1">更新完成的JAR文件，可直接用于部署</p>
                        </div>
                    </a>
                </div>
                
                <div class="card-hover p-4 bg-green-50 rounded-lg border border-green-100">
                    <a 
                        id="report-download" 
                        href="" 
                        class="flex items-center text-secondary hover:text-secondary/80 transition duration-300"
                        target="_blank"
                    >
                        <i class="fa fa-file-text-o text-2xl mr-4"></i>
                        <div>
                            <p class="font-medium">下载更新报告</p>
                            <p class="text-sm text-neutral mt-1">详细记录更新过程和变更内容</p>
                        </div>
                    </a>
                </div>
            </div>
        </div>
    </div>

    <!-- 文件选择模态框 -->
    <div id="choice-modal" class="fixed inset-0 bg-black bg-opacity-50 hidden items-center justify-center z-50" style="display: none;">
        <div class="glass-effect rounded-2xl shadow-2xl p-8 max-w-2xl w-full mx-4">
            <h2 class="text-2xl font-bold text-dark mb-4">
                <i class="fa fa-question-circle text-primary mr-2"></i>请选择文件
            </h2>
            <p class="text-neutral mb-2">文件名: <span id="choice-filename" class="font-medium text-dark"></span></p>
            <p class="text-neutral mb-4">目标路径: <span id="choice-dest" class="font-medium text-dark"></span></p>
            <p class="text-sm text-neutral mb-4">在补丁包中发现多个匹配的文件，请选择要使用的版本：</p>
            
            <div id="choice-options" class="space-y-2 mb-6 max-h-96 overflow-y-auto">
                <!-- 选项将动态插入这里 -->
            </div>
            
            <div class="flex justify-end space-x-4">
                <button id="choice-cancel" class="px-6 py-2 bg-gray-300 text-gray-700 rounded-lg hover:bg-gray-400 transition duration-300">
                    取消（使用第一个）
                </button>
                <button id="choice-confirm" class="btn-primary">
                    <i class="fa fa-check mr-2"></i>确认选择
                </button>
            </div>
        </div>
    </div>

        </div>
        <!-- 结束JAR包更新功能区域 -->
        
        <!-- Class路径匹配功能区域 -->
        <div id="match-section" class="function-section hidden">
            <div class="glass-effect rounded-2xl shadow-lg p-6 md:p-8 mb-8">
                <h2 class="text-xl font-semibold text-dark mb-6 pb-2 border-b">
                    <i class="fa fa-search mr-2 text-primary"></i>Class路径匹配
                </h2>
                
                <div class="mb-6 p-4 bg-blue-50 rounded-lg border border-blue-100">
                    <h3 class="font-medium text-dark mb-2">使用说明：</h3>
                    <ul class="text-sm text-neutral space-y-1 list-disc list-inside">
                        <li>上传一个JAR包文件</li>
                        <li>上传一个或多个要匹配的文件（支持所有文件类型，支持同时选择多个）</li>
                        <li>系统会自动在JAR包及其lib子目录中搜索匹配的文件</li>
                        <li>处理完成后可下载包含匹配结果的Excel文件</li>
                    </ul>
                </div>
                
                <form id="class-match-form" class="space-y-6">
                    <!-- JAR包上传 -->
                    <div class="space-y-2">
                        <label for="match_jar_file" class="block text-sm font-medium text-gray-700">
                            <i class="fa fa-file-archive-o mr-2 text-primary"></i>选择JAR包
                            <span class="text-red-500">*</span>
                        </label>
                        <div class="relative">
                            <input 
                                type="file" 
                                id="match_jar_file" 
                                name="jar_file" 
                                accept=".jar" 
                                required
                                class="sr-only"
                            >
                            <label for="match_jar_file" class="flex items-center justify-center w-full h-28 border-2 border-dashed border-gray-300 rounded-lg cursor-pointer bg-gray-50 hover:bg-gray-100 transition duration-300">
                                <div class="text-center">
                                    <i class="fa fa-cloud-upload text-3xl text-neutral mb-2"></i>
                                    <p class="text-sm text-neutral">点击或拖拽JAR文件至此</p>
                                    <p class="text-xs text-gray-500 mt-1">支持 .jar 格式</p>
                                </div>
                            </label>
                            <div id="match_jar_file_name" class="mt-2 text-sm text-gray-600 hidden"></div>
                        </div>
                    </div>
                    
                    <!-- Class文件上传（多选） -->
                    <div class="space-y-2">
                        <label for="match_class_files" class="block text-sm font-medium text-gray-700">
                            <i class="fa fa-file-code-o mr-2 text-secondary"></i>选择要匹配的文件（可多选）
                            <span class="text-red-500">*</span>
                        </label>
                        <div class="relative">
                            <input 
                                type="file" 
                                id="match_class_files" 
                                name="class_files" 
                                multiple
                                class="sr-only"
                            >
                            <label for="match_class_files" class="flex items-center justify-center w-full h-28 border-2 border-dashed border-gray-300 rounded-lg cursor-pointer bg-gray-50 hover:bg-gray-100 transition duration-300">
                                <div class="text-center">
                                    <i class="fa fa-cloud-upload text-3xl text-neutral mb-2"></i>
                                    <p class="text-sm text-neutral">点击或拖拽文件至此（可多选）</p>
                                    <p class="text-xs text-gray-500 mt-1">支持所有文件类型</p>
                                </div>
                            </label>
                            <div id="match_class_files_info" class="mt-2 text-sm text-gray-600 hidden"></div>
                            <div id="match_class_files_list" class="mt-2 space-y-2"></div>
                            <button type="button" id="add_more_files_btn" class="mt-2 px-4 py-2 bg-secondary text-white rounded-lg hover:bg-secondary/90 transition duration-300 hidden">
                                <i class="fa fa-plus mr-2"></i>继续添加文件
                            </button>
                        </div>
                    </div>
                    
                    <!-- 提交按钮 -->
                    <div class="pt-4 text-center">
                        <button type="submit" id="match-submit-btn" class="btn-primary">
                            <i class="fa fa-search mr-2"></i>开始匹配
                        </button>
                    </div>
                </form>
            </div>
            
            <!-- Class匹配进度显示区域 -->
            <div id="match-progress-container" class="glass-effect rounded-2xl shadow-lg p-6 md:p-8 mb-8 hidden">
                <h2 class="text-xl font-semibold text-dark mb-6 pb-2 border-b">
                    <i class="fa fa-cog fa-spin mr-2 text-primary"></i>匹配进度
                </h2>
                
                <div class="mb-4">
                    <div class="flex justify-between text-sm mb-1">
                        <span class="text-neutral">进度</span>
                        <span id="match-progress-text" class="font-medium text-primary">0%</span>
                    </div>
                    <div class="h-3 bg-gray-200 rounded-full overflow-hidden">
                        <div 
                            id="match-progress-bar" 
                            class="h-full bg-primary transition-all duration-300 progress-shine"
                            style="width: 0%;"
                        ></div>
                    </div>
                    <div class="mt-2 flex justify-between text-sm">
                        <span id="match-status-text" class="text-neutral">准备中...</span>
                        <span id="match-count-text" class="font-medium text-secondary">匹配数: 0</span>
                    </div>
                </div>
            </div>
            
            <!-- Class匹配下载区域 -->
            <div id="match-download-container" class="glass-effect rounded-2xl shadow-lg p-6 md:p-8 hidden">
                <h2 class="text-xl font-semibold text-dark mb-6 pb-2 border-b">
                    <i class="fa fa-check-circle mr-2 text-secondary"></i>匹配结果
                </h2>
                
                <div class="card-hover p-4 bg-green-50 rounded-lg border border-green-100">
                    <a 
                        id="match-excel-download" 
                        href="" 
                        class="flex items-center text-secondary hover:text-secondary/80 transition duration-300"
                        target="_blank"
                    >
                        <i class="fa fa-download text-2xl mr-4"></i>
                        <div>
                            <p class="font-medium">下载Excel结果文件</p>
                            <p class="text-sm text-neutral mt-1">包含匹配结果和未匹配文件列表</p>
                        </div>
                    </a>
                </div>
            </div>
        </div>
        <!-- 结束Class路径匹配功能区域 -->
        
        <!-- JAR包对比功能区域 -->
        <div id="compare-section" class="function-section hidden">
            <div class="glass-effect rounded-2xl shadow-lg p-6 md:p-8 mb-8">
                <h2 class="text-xl font-semibold text-dark mb-6 pb-2 border-b">
                    <i class="fa fa-exchange mr-2 text-primary"></i>JAR包对比
                </h2>
                
                <div class="mb-6 p-4 bg-blue-50 rounded-lg border border-blue-100">
                    <h3 class="font-medium text-dark mb-2">使用说明：</h3>
                    <ul class="text-sm text-neutral space-y-1 list-disc list-inside">
                        <li>上传两个JAR包文件进行对比</li>
                        <li>系统会自动对比两个JAR包中的所有文件（包括lib目录下的嵌套JAR包）</li>
                        <li>精确对比文件内容（使用MD5哈希值），可识别class文件内容是否一致</li>
                        <li>处理完成后可下载包含详细对比结果的Excel文件</li>
                    </ul>
                </div>
                
                <form id="jar-compare-form" class="space-y-6">
                    <!-- JAR包1上传 -->
                    <div class="space-y-2">
                        <label for="compare_jar1_file" class="block text-sm font-medium text-gray-700">
                            <i class="fa fa-file-archive-o mr-2 text-primary"></i>选择第一个JAR包
                            <span class="text-red-500">*</span>
                        </label>
                        <div class="relative">
                            <input 
                                type="file" 
                                id="compare_jar1_file" 
                                name="jar1" 
                                accept=".jar" 
                                required
                                class="sr-only"
                            >
                            <label for="compare_jar1_file" class="flex items-center justify-center w-full h-28 border-2 border-dashed border-gray-300 rounded-lg cursor-pointer bg-gray-50 hover:bg-gray-100 transition duration-300">
                                <div class="text-center">
                                    <i class="fa fa-cloud-upload text-3xl text-neutral mb-2"></i>
                                    <p class="text-sm text-neutral">点击或拖拽JAR文件至此</p>
                                    <p class="text-xs text-gray-500 mt-1">支持 .jar 格式</p>
                                </div>
                            </label>
                            <div id="compare_jar1_file_name" class="mt-2 text-sm text-gray-600 hidden"></div>
                        </div>
                    </div>
                    
                    <!-- JAR包2上传 -->
                    <div class="space-y-2">
                        <label for="compare_jar2_file" class="block text-sm font-medium text-gray-700">
                            <i class="fa fa-file-archive-o mr-2 text-secondary"></i>选择第二个JAR包
                            <span class="text-red-500">*</span>
                        </label>
                        <div class="relative">
                            <input 
                                type="file" 
                                id="compare_jar2_file" 
                                name="jar2" 
                                accept=".jar" 
                                required
                                class="sr-only"
                            >
                            <label for="compare_jar2_file" class="flex items-center justify-center w-full h-28 border-2 border-dashed border-gray-300 rounded-lg cursor-pointer bg-gray-50 hover:bg-gray-100 transition duration-300">
                                <div class="text-center">
                                    <i class="fa fa-cloud-upload text-3xl text-neutral mb-2"></i>
                                    <p class="text-sm text-neutral">点击或拖拽JAR文件至此</p>
                                    <p class="text-xs text-gray-500 mt-1">支持 .jar 格式</p>
                                </div>
                            </label>
                            <div id="compare_jar2_file_name" class="mt-2 text-sm text-gray-600 hidden"></div>
                        </div>
                    </div>
                    
                    <!-- 提交按钮 -->
                    <div class="pt-4 text-center">
                        <button type="submit" id="compare-submit-btn" class="btn-primary">
                            <i class="fa fa-exchange mr-2"></i>开始对比
                        </button>
                    </div>
                </form>
            </div>
            
            <!-- JAR包对比进度显示区域 -->
            <div id="compare-progress-container" class="glass-effect rounded-2xl shadow-lg p-6 md:p-8 mb-8 hidden">
                <h2 class="text-xl font-semibold text-dark mb-6 pb-2 border-b">
                    <i class="fa fa-cog fa-spin mr-2 text-primary"></i>对比进度
                </h2>
                
                <div class="mb-4">
                    <div class="flex justify-between text-sm mb-1">
                        <span class="text-neutral">进度</span>
                        <span id="compare-progress-text" class="font-medium text-primary">0%</span>
                    </div>
                    <div class="h-3 bg-gray-200 rounded-full overflow-hidden">
                        <div 
                            id="compare-progress-bar" 
                            class="h-full bg-primary transition-all duration-300 progress-shine"
                            style="width: 0%;"
                        ></div>
                    </div>
                    <div class="mt-2 flex justify-between text-sm">
                        <span id="compare-status-text" class="text-neutral">准备中...</span>
                        <span id="compare-count-text" class="font-medium text-secondary">已处理: 0 / 0</span>
                    </div>
                </div>
            </div>
            
            <!-- JAR包对比下载区域 -->
            <div id="compare-download-container" class="glass-effect rounded-2xl shadow-lg p-6 md:p-8 hidden">
                <h2 class="text-xl font-semibold text-dark mb-6 pb-2 border-b">
                    <i class="fa fa-check-circle mr-2 text-secondary"></i>对比结果
                </h2>
                
                <div class="card-hover p-4 bg-green-50 rounded-lg border border-green-100">
                    <a 
                        id="compare-excel-download" 
                        href="" 
                        class="flex items-center text-secondary hover:text-secondary/80 transition duration-300"
                        target="_blank"
                    >
                        <i class="fa fa-download text-2xl mr-4"></i>
                        <div>
                            <p class="font-medium">下载对比结果Excel文件</p>
                            <p class="text-sm text-neutral mt-1">包含详细的文件对比结果和统计信息</p>
                        </div>
                    </a>
                </div>
            </div>
        </div>
        <!-- 结束JAR包对比功能区域 -->
        
        <!-- 补丁检查功能区域 -->
        <div id="patch-check-section" class="function-section hidden">
            <div class="glass-effect rounded-2xl shadow-lg p-6 md:p-8 mb-8">
                <h2 class="text-xl font-semibold text-dark mb-6 pb-2 border-b">
                    <i class="fa fa-check-circle mr-2 text-primary"></i>补丁检查
                </h2>
                
                <div class="mb-6 p-4 bg-blue-50 rounded-lg border border-blue-100">
                    <h3 class="font-medium text-dark mb-2">使用说明：</h3>
                    <ul class="text-sm text-neutral space-y-1 list-disc list-inside">
                        <li>上传一个JAR包、Excel替换文件（表头：lib包、路径、文件名）和压缩包</li>
                        <li>系统将根据Excel中的路径检查JAR包和压缩包中对应的文件</li>
                        <li>检查文件是否存在，以及文件内容是否一致</li>
                        <li>检查结果将直接展示在页面上</li>
                    </ul>
                </div>
                
                <form id="patch-check-form" class="space-y-6">
                    <!-- JAR包上传 -->
                    <div class="space-y-2">
                        <label for="patch_jar_file" class="block text-sm font-medium text-gray-700">
                            <i class="fa fa-file-archive-o mr-2 text-primary"></i>选择JAR包
                            <span class="text-red-500">*</span>
                        </label>
                        <div class="relative">
                            <input 
                                type="file" 
                                id="patch_jar_file" 
                                name="jar_file" 
                                accept=".jar" 
                                required
                                class="sr-only"
                            >
                            <label for="patch_jar_file" class="flex items-center justify-center w-full h-28 border-2 border-dashed border-gray-300 rounded-lg cursor-pointer bg-gray-50 hover:bg-gray-100 transition duration-300">
                                <div class="text-center">
                                    <i class="fa fa-cloud-upload text-3xl text-neutral mb-2"></i>
                                    <p class="text-sm text-neutral">点击或拖拽JAR文件至此</p>
                                    <p class="text-xs text-gray-500 mt-1">支持 .jar 格式</p>
                                </div>
                            </label>
                            <div id="patch_jar_file_name" class="mt-2 text-sm text-gray-600 hidden"></div>
                        </div>
                    </div>
                    
                    <!-- Excel文件上传 -->
                    <div class="space-y-2">
                        <label for="patch_excel_file" class="block text-sm font-medium text-gray-700">
                            <i class="fa fa-file-excel-o mr-2 text-accent"></i>选择Excel替换文件
                            <span class="text-red-500">*</span>
                        </label>
                        <div class="relative">
                            <input 
                                type="file" 
                                id="patch_excel_file" 
                                name="excel_file" 
                                accept=".xlsx,.xls" 
                                required
                                class="sr-only"
                            >
                            <label for="patch_excel_file" class="flex items-center justify-center w-full h-28 border-2 border-dashed border-gray-300 rounded-lg cursor-pointer bg-gray-50 hover:bg-gray-100 transition duration-300">
                                <div class="text-center">
                                    <i class="fa fa-cloud-upload text-3xl text-neutral mb-2"></i>
                                    <p class="text-sm text-neutral">点击或拖拽Excel文件至此</p>
                                    <p class="text-xs text-gray-500 mt-1">支持 .xlsx, .xls 格式（表头：lib包、路径、文件名）</p>
                                </div>
                            </label>
                            <div id="patch_excel_file_name" class="mt-2 text-sm text-gray-600 hidden"></div>
                        </div>
                    </div>
                    
                    <!-- 压缩包上传 -->
                    <div class="space-y-2">
                        <label for="patch_zip_file" class="block text-sm font-medium text-gray-700">
                            <i class="fa fa-file-zip-o mr-2 text-secondary"></i>选择压缩包
                            <span class="text-red-500">*</span>
                        </label>
                        <div class="relative">
                            <input 
                                type="file" 
                                id="patch_zip_file" 
                                name="zip_file" 
                                accept=".zip,.rar" 
                                required
                                class="sr-only"
                            >
                            <label for="patch_zip_file" class="flex items-center justify-center w-full h-28 border-2 border-dashed border-gray-300 rounded-lg cursor-pointer bg-gray-50 hover:bg-gray-100 transition duration-300">
                                <div class="text-center">
                                    <i class="fa fa-cloud-upload text-3xl text-neutral mb-2"></i>
                                    <p class="text-sm text-neutral">点击或拖拽压缩包至此</p>
                                    <p class="text-xs text-gray-500 mt-1">支持 .zip, .rar 格式</p>
                                </div>
                            </label>
                            <div id="patch_zip_file_name" class="mt-2 text-sm text-gray-600 hidden"></div>
                        </div>
                    </div>
                    
                    <!-- 提交按钮 -->
                    <div class="pt-4 text-center">
                        <button type="submit" id="patch-check-submit-btn" class="btn-primary">
                            <i class="fa fa-check-circle mr-2"></i>开始检查
                        </button>
                    </div>
                </form>
            </div>
            
            <!-- 补丁检查进度显示区域 -->
            <div id="patch-check-progress-container" class="glass-effect rounded-2xl shadow-lg p-6 md:p-8 mb-8 hidden">
                <h2 class="text-xl font-semibold text-dark mb-6 pb-2 border-b">
                    <i class="fa fa-cog fa-spin mr-2 text-primary"></i>检查进度
                </h2>
                
                <div class="mb-4">
                    <div class="flex justify-between text-sm mb-1">
                        <span class="text-neutral">进度</span>
                        <span id="patch-check-progress-text" class="font-medium text-primary">0%</span>
                    </div>
                    <div class="h-3 bg-gray-200 rounded-full overflow-hidden">
                        <div 
                            id="patch-check-progress-bar" 
                            class="h-full bg-primary transition-all duration-300 progress-shine"
                            style="width: 0%;"
                        ></div>
                    </div>
                    <div class="mt-2 flex justify-between text-sm">
                        <span id="patch-check-status-text" class="text-neutral">准备中...</span>
                        <span id="patch-check-count-text" class="font-medium text-secondary">已处理: 0 / 0</span>
                    </div>
                </div>
            </div>
            
            <!-- 补丁检查结果展示区域 -->
            <div id="patch-check-result-container" class="glass-effect rounded-2xl shadow-lg p-6 md:p-8 hidden">
                <h2 class="text-xl font-semibold text-dark mb-6 pb-2 border-b">
                    <i class="fa fa-list-alt mr-2 text-secondary"></i>检查结果
                </h2>
                
                <!-- 统计信息 -->
                <div id="patch-check-summary" class="mb-6 grid grid-cols-2 md:grid-cols-4 gap-4"></div>
                
                <!-- 结果表格 -->
                <div class="overflow-x-auto">
                    <table id="patch-check-result-table" class="min-w-full divide-y divide-gray-200">
                        <thead class="bg-gray-50">
                            <tr>
                                <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">lib包</th>
                                <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">路径</th>
                                <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">文件名</th>
                                <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">状态</th>
                                <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">消息</th>
                                <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">JAR中存在</th>
                                <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">压缩包中存在</th>
                                <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">内容一致</th>
                            </tr>
                        </thead>
                        <tbody id="patch-check-result-tbody" class="bg-white divide-y divide-gray-200">
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <!-- 结束补丁检查功能区域 -->
        
    </div>
    <!-- 页脚 -->
    <footer class="text-center text-neutral text-sm py-6">
        <p>&copy; 2025 JAR包工具集 - 高效、安全的JAR文件管理解决方案</p>
    </footer>

    <script>
        // DOM元素
        const form = document.getElementById('update-form');
        const uploadCard = document.getElementById('upload-card');
        const uploadFormContent = document.getElementById('upload-form-content');
        const toggleUploadBtn = document.getElementById('toggle-upload');
        const progressContainer = document.getElementById('progress-container');
        const logsContainer = document.getElementById('logs-container');
        const downloadContainer = document.getElementById('download-container');
        const statusDiv = document.getElementById('status');
        const progressBar = document.getElementById('progress-bar');
        const progressText = document.getElementById('progress-text');
        const uploadProgressBar = document.getElementById('upload-progress-bar');
        const uploadProgressText = document.getElementById('upload-progress-text');
        const uploadStatus = document.getElementById('upload-status');
        const logsDiv = document.getElementById('logs');
        const jarDownloadLink = document.getElementById('jar-download');
        const reportDownloadLink = document.getElementById('report-download');
        const submitBtn = document.getElementById('submit-btn');
        
        // 文件上传元素
        const jarFileInput = document.getElementById('jar_file');
        const zipFileInput = document.getElementById('zip_file');
        const excelFileInput = document.getElementById('excel_file');
        const jarFileName = document.getElementById('jar_file_name');
        const zipFileName = document.getElementById('zip_file_name');
        const excelFileName = document.getElementById('excel_file_name');
        
        let taskId = null;
        let statusCheckInterval = null;
        let originalBtnText = submitBtn.innerHTML;
        let currentChoice = null;
        let selectedIndex = 0;
        let isUploadFormCollapsed = false;
        
        // 收缩上传表单
        function collapseUploadForm() {
            isUploadFormCollapsed = true;
            uploadFormContent.style.maxHeight = '0';
            uploadFormContent.style.opacity = '0';
            uploadFormContent.style.marginBottom = '0';
            submitBtn.parentElement.style.display = 'none';
            toggleUploadBtn.classList.remove('hidden');
            toggleUploadBtn.querySelector('i').classList.remove('fa-chevron-down');
            toggleUploadBtn.querySelector('i').classList.add('fa-chevron-up');
        }
        
        // 展开上传表单
        function expandUploadForm() {
            isUploadFormCollapsed = false;
            uploadFormContent.style.maxHeight = '2000px';
            uploadFormContent.style.opacity = '1';
            uploadFormContent.style.marginBottom = '';
            submitBtn.parentElement.style.display = '';
            toggleUploadBtn.querySelector('i').classList.remove('fa-chevron-up');
            toggleUploadBtn.querySelector('i').classList.add('fa-chevron-down');
        }
        
        // 切换上传表单显示/隐藏
        toggleUploadBtn.addEventListener('click', () => {
            if (isUploadFormCollapsed) {
                expandUploadForm();
            } else {
                collapseUploadForm();
            }
        });
        
        // 清除文件选择
        function clearFileInputs() {
            // 重置文件输入控件
            jarFileInput.value = '';
            zipFileInput.value = '';
            excelFileInput.value = '';
            
            // 隐藏文件名显示
            jarFileName.textContent = '';
            jarFileName.classList.add('hidden');
            zipFileName.textContent = '';
            zipFileName.classList.add('hidden');
            excelFileName.textContent = '';
            excelFileName.classList.add('hidden');
            
            // 移除边框高亮样式
            jarFileInput.parentElement.classList.remove('border-primary');
            zipFileInput.parentElement.classList.remove('border-secondary');
            excelFileInput.parentElement.classList.remove('border-accent');
            
            // 展开上传表单，让用户可以重新上传
            if (isUploadFormCollapsed) {
                expandUploadForm();
            }
        }
        
        // 显示选中的文件名
        jarFileInput.addEventListener('change', (e) => {
            if (e.target.files.length > 0) {
                jarFileName.textContent = e.target.files[0].name;
                jarFileName.classList.remove('hidden');
                // 添加文件选择动画效果
                e.target.parentElement.classList.add('border-primary');
                setTimeout(() => {
                    e.target.parentElement.classList.remove('border-primary');
                }, 500);
            }
        });
        
        zipFileInput.addEventListener('change', (e) => {
            if (e.target.files.length > 0) {
                zipFileName.textContent = e.target.files[0].name;
                zipFileName.classList.remove('hidden');
                // 添加文件选择动画效果
                e.target.parentElement.classList.add('border-secondary');
                setTimeout(() => {
                    e.target.parentElement.classList.remove('border-secondary');
                }, 500);
            }
        });
        
        excelFileInput.addEventListener('change', (e) => {
            if (e.target.files.length > 0) {
                excelFileName.textContent = e.target.files[0].name;
                excelFileName.classList.remove('hidden');
                // 添加文件选择动画效果
                e.target.parentElement.classList.add('border-accent');
                setTimeout(() => {
                    e.target.parentElement.classList.remove('border-accent');
                }, 500);
            }
        });
        
        // 表单提交处理（带上传进度）
        form.addEventListener('submit', async (e) => {
            e.preventDefault();
            
            // 禁用提交按钮，防止重复提交
            submitBtn.disabled = true;
            submitBtn.innerHTML = '<i class="fa fa-spinner fa-spin mr-2"></i>处理中...';
            
            // 收缩上传表单
            collapseUploadForm();
            
            const formData = new FormData(form);
            
            try {
                // 初始化上传进度显示
                progressContainer.classList.remove('hidden');
                logsContainer.classList.remove('hidden');
                uploadStatus.textContent = '正在上传...';
                uploadProgressBar.style.width = '0%';
                uploadProgressText.textContent = '0%';

                // 使用XHR以支持上传进度
                await new Promise((resolve, reject) => {
                    const xhr = new XMLHttpRequest();
                    xhr.open('POST', '/update');

                    xhr.upload.onprogress = (event) => {
                        if (event.lengthComputable) {
                            const percent = Math.round((event.loaded / event.total) * 100);
                            uploadProgressBar.style.width = percent + '%';
                            uploadProgressText.textContent = percent + '%';
                        } else {
                            uploadStatus.textContent = '正在上传（无法计算总大小）...';
                        }
                    };

                    xhr.onload = () => {
                        try {
                            const contentType = xhr.getResponseHeader('content-type') || '';
                            if (!contentType.includes('application/json')) {
                                throw new Error('服务器返回了非JSON响应，可能发生了内部错误');
                            }
                            if (xhr.status >= 200 && xhr.status < 300) {
                                const data = JSON.parse(xhr.responseText);
                                taskId = data.task_id;
                                // 上传完成标记
                                uploadProgressBar.style.width = '100%';
                                uploadProgressText.textContent = '100%';
                                uploadStatus.textContent = '上传完成，开始处理...';

                                // 滚动到进度区域并开始轮询处理进度
                                progressContainer.scrollIntoView({ behavior: 'smooth' });
                                startCheckingStatus();
                                resolve(null);
                            } else {
                                const errData = JSON.parse(xhr.responseText || '{}');
                                reject(new Error(errData.error || '更新失败'));
                            }
                        } catch (e2) {
                            reject(e2);
                        }
                    };

                    xhr.onerror = () => reject(new Error('网络错误，无法连接服务器'));

                    xhr.send(formData);
                });

            } catch (error) {
                showNotification('错误', error.message, 'error');
                submitBtn.disabled = false;
                submitBtn.innerHTML = originalBtnText;
                clearFileInputs();
            }
        });
        
        // 开始检查状态
        function startCheckingStatus() {
            if (statusCheckInterval) {
                clearInterval(statusCheckInterval);
            }
            
            statusCheckInterval = setInterval(async () => {
                try {
                    const response = await fetch(`/status/${taskId}`);
                    const data = await response.json();
                    
                    if (data.error) {
                        throw new Error(data.error);
                    }
                    
                    // 更新状态（添加状态变化动画）
                    if (statusDiv.textContent !== data.status) {
                        statusDiv.classList.add('text-primary');
                        setTimeout(() => {
                            statusDiv.classList.remove('text-primary');
                        }, 500);
                    }
                    statusDiv.textContent = data.status;
                    
                    // 更新进度
                    const progress = data.progress || 0;
                    progressBar.style.width = `${progress}%`;
                    progressText.textContent = `${progress}%`;
                    
                    // 检查是否有待处理的选择
                    if (data.pending_choice) {
                        showChoiceModal(data.pending_choice);
                    }
                    
                    // 添加新日志
                    if (data.new_logs && data.new_logs.length > 0) {
                        data.new_logs.forEach(log => {
                            const logElement = document.createElement('div');
                            
                            // 根据日志内容添加不同的样式和图标
                            if (log.includes('错误') || (log.includes('失败') && !log.includes('个 (失败:'))) {
                                logElement.className = 'text-red-600 mb-1';
                                logElement.innerHTML = `<i class="fa fa-exclamation-circle mr-2"></i>${log}`;
                            } else if (log.includes('完成') || log.includes('成功')) {
                                logElement.className = 'text-green-600 mb-1';
                                logElement.innerHTML = `<i class="fa fa-check-circle mr-2"></i>${log}`;
                            } else if (log.includes('警告')) {
                                logElement.className = 'text-yellow-600 mb-1';
                                logElement.innerHTML = `<i class="fa fa-exclamation-triangle mr-2"></i>${log}`;
                            } else {
                                logElement.className = 'text-gray-700 mb-1';
                                logElement.innerHTML = `<i class="fa fa-info-circle mr-2 text-blue-500"></i>${log}`;
                            }
                            
                            logsDiv.appendChild(logElement);
                        });
                        // 滚动到底部
                        logsDiv.scrollTop = logsDiv.scrollHeight;
                    }
                    
                    // 如果任务完成，停止检查并显示下载链接
                    if (data.is_complete) {
                        clearInterval(statusCheckInterval);
                        
                        // 恢复按钮状态
                        submitBtn.disabled = false;
                        submitBtn.innerHTML = originalBtnText;
                        
                        // 清除文件选择
                        clearFileInputs();
                        
                        if (data.status === '更新完成') {
                            // 添加完成动画效果
                            progressBar.classList.add('bg-secondary');
                            
                            // 显示下载链接区域
                            setTimeout(() => {
                                downloadContainer.classList.remove('hidden');
                                downloadContainer.scrollIntoView({ behavior: 'smooth' });
                                jarDownloadLink.href = `/download/${taskId}/jar`;
                                reportDownloadLink.href = `/download/${taskId}/report`;
                            }, 800);
                            
                            // 显示成功通知
                            showNotification('成功', 'JAR包更新完成！', 'success');
                        } else {
                            // 显示失败通知
                            showNotification('失败', data.status, 'error');
                        }
                    }
                    
                } catch (error) {
                    clearInterval(statusCheckInterval);
                    
                    // 恢复按钮状态
                    submitBtn.disabled = false;
                    submitBtn.innerHTML = originalBtnText;
                    
                    // 清除文件选择
                    clearFileInputs();
                    
                    // 显示错误日志
                    const errorElement = document.createElement('div');
                    errorElement.className = 'text-red-600 mb-1';
                    errorElement.innerHTML = `<i class="fa fa-exclamation-circle mr-2"></i>获取状态失败: ${error.message}`;
                    logsDiv.appendChild(errorElement);
                    logsDiv.scrollTop = logsDiv.scrollHeight;
                    
                    // 显示错误通知
                    showNotification('错误', '获取更新状态失败', 'error');
                }
            }, 1000);
        }
        
        // 显示文件选择模态框
        function showChoiceModal(choice) {
            // 如果是同一个选择，不重新渲染（避免重置选择）
            if (currentChoice && currentChoice.id === choice.id) {
                return;
            }
            
            currentChoice = choice;
            selectedIndex = 0; // 默认选择第一个
            
            const modal = document.getElementById('choice-modal');
            const filenameSpan = document.getElementById('choice-filename');
            const destSpan = document.getElementById('choice-dest');
            const optionsDiv = document.getElementById('choice-options');
            
            filenameSpan.textContent = choice.filename;
            destSpan.textContent = choice.dest_path;
            
            // 清空并重新生成选项
            optionsDiv.innerHTML = '';
            choice.candidates.forEach((candidate, index) => {
                const optionDiv = document.createElement('div');
                optionDiv.className = 'p-4 border-2 rounded-lg cursor-pointer transition-all duration-300 hover:border-primary';
                optionDiv.dataset.index = index; // 存储索引到data属性
                optionDiv.innerHTML = `
                    <div class="flex items-center">
                        <input type="radio" name="file-choice" value="${index}" ${index === 0 ? 'checked' : ''} class="mr-3" id="choice-radio-${index}">
                        <div class="flex-1">
                            <p class="font-medium text-dark">${candidate.path}</p>
                            <p class="text-sm text-neutral mt-1">修改时间: ${candidate.timestamp}</p>
                        </div>
                    </div>
                `;
                
                // 点击整个div选中该选项
                optionDiv.addEventListener('click', (e) => {
                    const clickedIndex = parseInt(optionDiv.dataset.index);
                    console.log('点击选项，索引:', clickedIndex);
                    
                    // 立即更新全局变量
                    selectedIndex = clickedIndex;
                    console.log('selectedIndex 已更新为:', selectedIndex);
                    
                    // 更新所有单选按钮状态
                    document.querySelectorAll('input[name="file-choice"]').forEach(radio => {
                        radio.checked = false;
                    });
                    const radio = document.getElementById(`choice-radio-${clickedIndex}`);
                    if (radio) {
                        radio.checked = true;
                    }
                    
                    // 更新所有选项的样式
                    document.querySelectorAll('#choice-options > div').forEach(div => {
                        div.classList.remove('border-primary', 'bg-blue-50');
                    });
                    optionDiv.classList.add('border-primary', 'bg-blue-50');
                });
                
                if (index === 0) {
                    optionDiv.classList.add('border-primary', 'bg-blue-50');
                }
                optionsDiv.appendChild(optionDiv);
            });
            
            // 显示模态框
            modal.style.display = 'flex';
        }
        
        // 确认选择
        document.getElementById('choice-confirm').addEventListener('click', async () => {
            if (!currentChoice) return;
            
            // 记录日志，帮助调试
            console.log('提交选择:', {
                choice_id: currentChoice.id,
                selected_index: selectedIndex,
                filename: currentChoice.filename
            });
            
            try {
                const response = await fetch(`/choice/${taskId}`, {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json'
                    },
                    body: JSON.stringify({
                        choice_id: currentChoice.id,
                        selected_index: selectedIndex
                    })
                });
                
                if (response.ok) {
                    document.getElementById('choice-modal').style.display = 'none';
                    currentChoice = null;
                    showNotification('成功', `已选择文件（索引: ${selectedIndex}）`, 'success');
                } else {
                    showNotification('错误', '提交选择失败', 'error');
                }
            } catch (error) {
                console.error('提交选择错误:', error);
                showNotification('错误', '提交选择时发生错误', 'error');
            }
        });
        
        // 取消选择（使用第一个）
        document.getElementById('choice-cancel').addEventListener('click', async () => {
            if (!currentChoice) return;
            
            try {
                const response = await fetch(`/choice/${taskId}`, {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json'
                    },
                    body: JSON.stringify({
                        choice_id: currentChoice.id,
                        selected_index: 0
                    })
                });
                
                if (response.ok) {
                    document.getElementById('choice-modal').style.display = 'none';
                    currentChoice = null;
                } else {
                    showNotification('错误', '提交选择失败', 'error');
                }
            } catch (error) {
                showNotification('错误', '提交选择时发生错误', 'error');
            }
        });
        
        // 显示通知函数
        function showNotification(title, message, type = 'info') {
            // 创建通知元素
            const notification = document.createElement('div');
            
            // 设置样式和内容
            notification.className = `fixed top-4 right-4 p-4 rounded-lg shadow-lg z-50 transform transition-all duration-500 ease-out translate-x-full`;
            
            // 根据类型设置不同的颜色
            if (type === 'success') {
                notification.classList.add('bg-green-50', 'border', 'border-green-200');
                notification.innerHTML = `
                    <div class="flex items-center">
                        <i class="fa fa-check-circle text-green-500 text-xl mr-3"></i>
                        <div>
                            <p class="font-medium text-green-800">${title}</p>
                            <p class="text-green-700 text-sm">${message}</p>
                        </div>
                    </div>
                `;
            } else if (type === 'error') {
                notification.classList.add('bg-red-50', 'border', 'border-red-200');
                notification.innerHTML = `
                    <div class="flex items-center">
                        <i class="fa fa-exclamation-circle text-red-500 text-xl mr-3"></i>
                        <div>
                            <p class="font-medium text-red-800">${title}</p>
                            <p class="text-red-700 text-sm">${message}</p>
                        </div>
                    </div>
                `;
            } else {
                notification.classList.add('bg-blue-50', 'border', 'border-blue-200');
                notification.innerHTML = `
                    <div class="flex items-center">
                        <i class="fa fa-info-circle text-blue-500 text-xl mr-3"></i>
                        <div>
                            <p class="font-medium text-blue-800">${title}</p>
                            <p class="text-blue-700 text-sm">${message}</p>
                        </div>
                    </div>
                `;
            }
            
            // 添加到页面
            document.body.appendChild(notification);
            
            // 显示通知
            setTimeout(() => {
                notification.classList.remove('translate-x-full');
            }, 10);
            
            // 3秒后自动关闭
            setTimeout(() => {
                notification.classList.add('translate-x-full');
                setTimeout(() => {
                    document.body.removeChild(notification);
                }, 500);
            }, 3000);
        }
        
        // ==================== 标签页切换功能 ====================
        const tabUpdate = document.getElementById('tab-update');
        const tabMatch = document.getElementById('tab-match');
        const tabCompare = document.getElementById('tab-compare');
        const tabPatchCheck = document.getElementById('tab-patch-check');
        const updateSection = document.getElementById('update-section');
        const matchSection = document.getElementById('match-section');
        const compareSection = document.getElementById('compare-section');
        const patchCheckSection = document.getElementById('patch-check-section');
        
        function switchTab(activeTab, activeSection) {
            // 重置所有标签
            [tabUpdate, tabMatch, tabCompare, tabPatchCheck].forEach(tab => {
                tab.classList.remove('active', 'text-primary', 'border-b-2', 'border-primary');
                tab.classList.add('text-neutral');
            });
            // 设置活动标签
            activeTab.classList.add('active', 'text-primary', 'border-b-2', 'border-primary');
            activeTab.classList.remove('text-neutral');
            
            // 隐藏所有区域
            [updateSection, matchSection, compareSection, patchCheckSection].forEach(section => {
                section.classList.add('hidden');
            });
            // 显示活动区域
            activeSection.classList.remove('hidden');
        }
        
        tabUpdate.addEventListener('click', () => {
            switchTab(tabUpdate, updateSection);
        });
        
        tabMatch.addEventListener('click', () => {
            switchTab(tabMatch, matchSection);
        });
        
        tabCompare.addEventListener('click', () => {
            switchTab(tabCompare, compareSection);
        });
        
        tabPatchCheck.addEventListener('click', () => {
            switchTab(tabPatchCheck, patchCheckSection);
        });
        
        // ==================== Class路径匹配功能 ====================
        const classMatchForm = document.getElementById('class-match-form');
        const matchJarFileInput = document.getElementById('match_jar_file');
        const matchClassFilesInput = document.getElementById('match_class_files');
        const matchJarFileName = document.getElementById('match_jar_file_name');
        const matchClassFilesInfo = document.getElementById('match_class_files_info');
        const matchClassFilesList = document.getElementById('match_class_files_list');
        const addMoreFilesBtn = document.getElementById('add_more_files_btn');
        const matchSubmitBtn = document.getElementById('match-submit-btn');
        const matchProgressContainer = document.getElementById('match-progress-container');
        const matchProgressBar = document.getElementById('match-progress-bar');
        const matchProgressText = document.getElementById('match-progress-text');
        const matchStatusText = document.getElementById('match-status-text');
        const matchCountText = document.getElementById('match-count-text');
        const matchDownloadContainer = document.getElementById('match-download-container');
        const matchExcelDownload = document.getElementById('match-excel-download');
        
        let selectedMatchFiles = [];
        let matchTaskId = null;
        let matchProgressInterval = null;
        
        // 显示选中的JAR文件名
        matchJarFileInput.addEventListener('change', (e) => {
            if (e.target.files.length > 0) {
                matchJarFileName.textContent = e.target.files[0].name;
                matchJarFileName.classList.remove('hidden');
            }
        });
        
        // 更新Class文件列表显示
        function updateMatchClassFileList() {
            if (selectedMatchFiles.length === 0) {
                matchClassFilesList.innerHTML = '';
                matchClassFilesInfo.classList.add('hidden');
                addMoreFilesBtn.classList.add('hidden');
                return;
            }
            
            matchClassFilesInfo.textContent = `已选择 ${selectedMatchFiles.length} 个文件`;
            matchClassFilesInfo.classList.remove('hidden');
            addMoreFilesBtn.classList.remove('hidden');
            
            matchClassFilesList.innerHTML = '';
            selectedMatchFiles.forEach((file, index) => {
                const fileItem = document.createElement('div');
                fileItem.className = 'flex items-center justify-between p-2 bg-gray-50 rounded border border-gray-200';
                fileItem.innerHTML = `
                    <span class="text-sm text-gray-700 flex-1">${file.name}</span>
                    <span class="text-xs text-gray-500 mr-2">${(file.size / 1024).toFixed(1)} KB</span>
                    <button type="button" class="px-2 py-1 bg-red-500 text-white text-xs rounded hover:bg-red-600" onclick="removeMatchFile(${index})">删除</button>
                `;
                matchClassFilesList.appendChild(fileItem);
            });
        }
        
        // 添加文件
        function addMatchFiles(files) {
            const allFiles = Array.from(files);
            allFiles.forEach(file => {
                const exists = selectedMatchFiles.some(f => f.name === file.name);
                if (!exists) {
                    selectedMatchFiles.push(file);
                }
            });
            updateMatchClassFileList();
            matchClassFilesInput.value = '';
        }
        
        // 删除文件
        window.removeMatchFile = function(index) {
            selectedMatchFiles.splice(index, 1);
            updateMatchClassFileList();
        };
        
        matchClassFilesInput.addEventListener('change', function() {
            if (this.files.length > 0) {
                addMatchFiles(this.files);
            }
        });
        
        addMoreFilesBtn.addEventListener('click', () => {
            matchClassFilesInput.click();
        });
        
        // 表单提交
        classMatchForm.addEventListener('submit', async (e) => {
            e.preventDefault();
            
            if (!matchJarFileInput.files[0]) {
                showNotification('错误', '请选择JAR文件', 'error');
                return;
            }
            
            if (selectedMatchFiles.length === 0) {
                showNotification('错误', '请至少添加一个要匹配的文件', 'error');
                return;
            }
            
            const formData = new FormData();
            formData.append('jar_file', matchJarFileInput.files[0]);
            selectedMatchFiles.forEach(file => {
                formData.append('class_files', file);
            });
            
            matchSubmitBtn.disabled = true;
            matchSubmitBtn.innerHTML = '<i class="fa fa-spinner fa-spin mr-2"></i>处理中...';
            matchProgressContainer.classList.remove('hidden');
            matchProgressBar.style.width = '0%';
            matchProgressText.textContent = '0%';
            matchStatusText.textContent = '上传文件中...';
            matchCountText.textContent = '匹配数: 0';
            matchDownloadContainer.classList.add('hidden');
            
            try {
                const response = await fetch('/class-match/upload', {
                    method: 'POST',
                    body: formData
                });
                
                const data = await response.json();
                
                if (!response.ok) {
                    throw new Error(data.error || '上传失败');
                }
                
                matchTaskId = data.task_id;
                startMatchProgressCheck();
            } catch (error) {
                showNotification('错误', error.message, 'error');
                matchSubmitBtn.disabled = false;
                matchSubmitBtn.innerHTML = '<i class="fa fa-search mr-2"></i>开始匹配';
                matchStatusText.textContent = '错误: ' + error.message;
            }
        });
        
        // 开始进度检查
        function startMatchProgressCheck() {
            if (matchProgressInterval) {
                clearInterval(matchProgressInterval);
            }
            
            matchProgressInterval = setInterval(async () => {
                if (!matchTaskId) return;
                
                try {
                    const response = await fetch(`/class-match/progress/${matchTaskId}`);
                    const data = await response.json();
                    
                    if (!response.ok) {
                        throw new Error(data.error || '获取进度失败');
                    }
                    
                    updateMatchProgress(data);
                } catch (error) {
                    console.error('获取进度错误:', error);
                    clearInterval(matchProgressInterval);
                }
            }, 1000);
        }
        
        // 更新进度显示
        function updateMatchProgress(data) {
            const { total, processed, matches, status } = data;
            
            if (status === 'completed') {
                clearInterval(matchProgressInterval);
                matchProgressBar.style.width = '100%';
                matchProgressText.textContent = '100%';
                matchStatusText.textContent = '处理完成';
                matchCountText.textContent = `匹配数: ${matches}`;
                matchDownloadContainer.classList.remove('hidden');
                matchExcelDownload.href = `/class-match/download/${matchTaskId}`;
                matchSubmitBtn.disabled = false;
                matchSubmitBtn.innerHTML = '<i class="fa fa-search mr-2"></i>开始匹配';
                showNotification('成功', '匹配完成！可以下载结果了。', 'success');
            } else if (status && status.startsWith('error:')) {
                clearInterval(matchProgressInterval);
                matchStatusText.textContent = '错误: ' + status.substring(7);
                matchSubmitBtn.disabled = false;
                matchSubmitBtn.innerHTML = '<i class="fa fa-search mr-2"></i>开始匹配';
                showNotification('错误', status.substring(7), 'error');
            } else {
                const percentage = total > 0 ? Math.round((processed / total) * 100) : 0;
                matchProgressBar.style.width = percentage + '%';
                matchProgressText.textContent = percentage + '%';
                matchStatusText.textContent = `处理中... (${processed}/${total})`;
                matchCountText.textContent = `匹配数: ${matches}`;
            }
        }
        
        // ==================== JAR包对比功能 ====================
        const jarCompareForm = document.getElementById('jar-compare-form');
        const compareJar1FileInput = document.getElementById('compare_jar1_file');
        const compareJar2FileInput = document.getElementById('compare_jar2_file');
        const compareJar1FileName = document.getElementById('compare_jar1_file_name');
        const compareJar2FileName = document.getElementById('compare_jar2_file_name');
        const compareSubmitBtn = document.getElementById('compare-submit-btn');
        const compareProgressContainer = document.getElementById('compare-progress-container');
        const compareProgressBar = document.getElementById('compare-progress-bar');
        const compareProgressText = document.getElementById('compare-progress-text');
        const compareStatusText = document.getElementById('compare-status-text');
        const compareCountText = document.getElementById('compare-count-text');
        const compareDownloadContainer = document.getElementById('compare-download-container');
        const compareExcelDownload = document.getElementById('compare-excel-download');
        
        let compareTaskId = null;
        let compareProgressInterval = null;
        
        // 显示选中的JAR文件名
        compareJar1FileInput.addEventListener('change', (e) => {
            if (e.target.files.length > 0) {
                compareJar1FileName.textContent = e.target.files[0].name;
                compareJar1FileName.classList.remove('hidden');
            }
        });
        
        compareJar2FileInput.addEventListener('change', (e) => {
            if (e.target.files.length > 0) {
                compareJar2FileName.textContent = e.target.files[0].name;
                compareJar2FileName.classList.remove('hidden');
            }
        });
        
        // 表单提交
        jarCompareForm.addEventListener('submit', async (e) => {
            e.preventDefault();
            
            if (!compareJar1FileInput.files[0]) {
                showNotification('错误', '请选择第一个JAR文件', 'error');
                return;
            }
            
            if (!compareJar2FileInput.files[0]) {
                showNotification('错误', '请选择第二个JAR文件', 'error');
                return;
            }
            
            const formData = new FormData();
            formData.append('jar1', compareJar1FileInput.files[0]);
            formData.append('jar2', compareJar2FileInput.files[0]);
            
            compareSubmitBtn.disabled = true;
            compareSubmitBtn.innerHTML = '<i class="fa fa-spinner fa-spin mr-2"></i>处理中...';
            compareProgressContainer.classList.remove('hidden');
            compareProgressBar.style.width = '0%';
            compareProgressText.textContent = '0%';
            compareStatusText.textContent = '上传文件中...';
            compareCountText.textContent = '已处理: 0 / 0';
            compareDownloadContainer.classList.add('hidden');
            
            try {
                const response = await fetch('/jar-compare/upload', {
                    method: 'POST',
                    body: formData
                });
                
                const data = await response.json();
                
                if (!response.ok) {
                    throw new Error(data.error || '上传失败');
                }
                
                compareTaskId = data.task_id;
                startCompareProgressCheck();
            } catch (error) {
                showNotification('错误', error.message, 'error');
                compareSubmitBtn.disabled = false;
                compareSubmitBtn.innerHTML = '<i class="fa fa-exchange mr-2"></i>开始对比';
                compareStatusText.textContent = '错误: ' + error.message;
            }
        });
        
        // 开始进度检查
        function startCompareProgressCheck() {
            if (compareProgressInterval) {
                clearInterval(compareProgressInterval);
            }
            
            compareProgressInterval = setInterval(async () => {
                if (!compareTaskId) return;
                
                try {
                    const response = await fetch(`/jar-compare/progress/${compareTaskId}`);
                    const data = await response.json();
                    
                    if (!response.ok) {
                        throw new Error(data.error || '获取进度失败');
                    }
                    
                    updateCompareProgress(data);
                } catch (error) {
                    console.error('获取进度错误:', error);
                    clearInterval(compareProgressInterval);
                }
            }, 1000);
        }
        
        // 更新进度显示
        function updateCompareProgress(data) {
            const { total, processed, status } = data;
            
            if (status === 'completed') {
                clearInterval(compareProgressInterval);
                compareProgressBar.style.width = '100%';
                compareProgressText.textContent = '100%';
                compareStatusText.textContent = '对比完成';
                compareCountText.textContent = `已处理: ${processed} / ${total}`;
                compareDownloadContainer.classList.remove('hidden');
                compareExcelDownload.href = `/jar-compare/download/${compareTaskId}`;
                compareSubmitBtn.disabled = false;
                compareSubmitBtn.innerHTML = '<i class="fa fa-exchange mr-2"></i>开始对比';
                showNotification('成功', '对比完成！可以下载结果了。', 'success');
            } else if (status && status.startsWith('error:')) {
                clearInterval(compareProgressInterval);
                compareStatusText.textContent = '错误: ' + status.substring(7);
                compareSubmitBtn.disabled = false;
                compareSubmitBtn.innerHTML = '<i class="fa fa-exchange mr-2"></i>开始对比';
                showNotification('错误', status.substring(7), 'error');
            } else {
                const percentage = total > 0 ? Math.round((processed / total) * 100) : 0;
                compareProgressBar.style.width = percentage + '%';
                compareProgressText.textContent = percentage + '%';
                
                // 根据状态显示不同的文本
                let statusDisplay = '处理中...';
                if (status === 'analyzing') {
                    statusDisplay = '正在分析JAR包...';
                } else if (status === 'analyzing_jar2') {
                    statusDisplay = '正在分析第二个JAR包...';
                } else if (status === 'comparing') {
                    statusDisplay = '正在对比文件...';
                } else if (status === 'processing') {
                    statusDisplay = '正在处理文件...';
                } else if (status === 'starting') {
                    statusDisplay = '准备开始...';
                }
                
                compareStatusText.textContent = statusDisplay;
                compareCountText.textContent = `已处理: ${processed} / ${total}`;
            }
        }
        
        // ==================== 补丁检查功能 ====================
        const patchCheckForm = document.getElementById('patch-check-form');
        const patchJarFileInput = document.getElementById('patch_jar_file');
        const patchExcelFileInput = document.getElementById('patch_excel_file');
        const patchZipFileInput = document.getElementById('patch_zip_file');
        const patchJarFileName = document.getElementById('patch_jar_file_name');
        const patchExcelFileName = document.getElementById('patch_excel_file_name');
        const patchZipFileName = document.getElementById('patch_zip_file_name');
        const patchCheckSubmitBtn = document.getElementById('patch-check-submit-btn');
        const patchCheckProgressContainer = document.getElementById('patch-check-progress-container');
        const patchCheckProgressBar = document.getElementById('patch-check-progress-bar');
        const patchCheckProgressText = document.getElementById('patch-check-progress-text');
        const patchCheckStatusText = document.getElementById('patch-check-status-text');
        const patchCheckCountText = document.getElementById('patch-check-count-text');
        const patchCheckResultContainer = document.getElementById('patch-check-result-container');
        const patchCheckSummary = document.getElementById('patch-check-summary');
        const patchCheckResultTbody = document.getElementById('patch-check-result-tbody');
        
        let patchCheckTaskId = null;
        let patchCheckProgressInterval = null;
        
        // 显示选中的文件名
        patchJarFileInput.addEventListener('change', (e) => {
            if (e.target.files.length > 0) {
                patchJarFileName.textContent = e.target.files[0].name;
                patchJarFileName.classList.remove('hidden');
            }
        });
        
        patchExcelFileInput.addEventListener('change', (e) => {
            if (e.target.files.length > 0) {
                patchExcelFileName.textContent = e.target.files[0].name;
                patchExcelFileName.classList.remove('hidden');
            }
        });
        
        patchZipFileInput.addEventListener('change', (e) => {
            if (e.target.files.length > 0) {
                patchZipFileName.textContent = e.target.files[0].name;
                patchZipFileName.classList.remove('hidden');
            }
        });
        
        // 表单提交
        patchCheckForm.addEventListener('submit', async (e) => {
            e.preventDefault();
            
            if (!patchJarFileInput.files[0]) {
                showNotification('错误', '请选择JAR文件', 'error');
                return;
            }
            
            if (!patchExcelFileInput.files[0]) {
                showNotification('错误', '请选择Excel文件', 'error');
                return;
            }
            
            if (!patchZipFileInput.files[0]) {
                showNotification('错误', '请选择压缩包文件', 'error');
                return;
            }
            
            const formData = new FormData();
            formData.append('jar_file', patchJarFileInput.files[0]);
            formData.append('excel_file', patchExcelFileInput.files[0]);
            formData.append('zip_file', patchZipFileInput.files[0]);
            
            patchCheckSubmitBtn.disabled = true;
            patchCheckSubmitBtn.innerHTML = '<i class="fa fa-spinner fa-spin mr-2"></i>处理中...';
            patchCheckProgressContainer.classList.remove('hidden');
            patchCheckResultContainer.classList.add('hidden');
            patchCheckProgressBar.style.width = '0%';
            patchCheckProgressText.textContent = '0%';
            patchCheckStatusText.textContent = '上传文件中...';
            patchCheckCountText.textContent = '已处理: 0 / 0';
            
            try {
                const response = await fetch('/patch-check/upload', {
                    method: 'POST',
                    body: formData
                });
                
                const data = await response.json();
                
                if (!response.ok) {
                    throw new Error(data.error || '上传失败');
                }
                
                patchCheckTaskId = data.task_id;
                startPatchCheckProgressCheck();
            } catch (error) {
                showNotification('错误', error.message, 'error');
                patchCheckSubmitBtn.disabled = false;
                patchCheckSubmitBtn.innerHTML = '<i class="fa fa-check-circle mr-2"></i>开始检查';
                patchCheckStatusText.textContent = '错误: ' + error.message;
            }
        });
        
        // 开始进度检查
        function startPatchCheckProgressCheck() {
            if (patchCheckProgressInterval) {
                clearInterval(patchCheckProgressInterval);
            }
            
            patchCheckProgressInterval = setInterval(async () => {
                if (!patchCheckTaskId) return;
                
                try {
                    const response = await fetch(`/patch-check/progress/${patchCheckTaskId}`);
                    const data = await response.json();
                    
                    if (!response.ok) {
                        throw new Error(data.error || '获取进度失败');
                    }
                    
                    updatePatchCheckProgress(data);
                } catch (error) {
                    console.error('获取进度错误:', error);
                    clearInterval(patchCheckProgressInterval);
                }
            }, 1000);
        }
        
        // 更新进度显示
        function updatePatchCheckProgress(data) {
            const { total, processed, status, completed, task_status } = data;
            
            if (task_status === 'completed' && completed) {
                clearInterval(patchCheckProgressInterval);
                patchCheckProgressBar.style.width = '100%';
                patchCheckProgressText.textContent = '100%';
                patchCheckStatusText.textContent = '检查完成';
                patchCheckCountText.textContent = `已处理: ${processed || total} / ${total}`;
                
                // 获取结果
                fetchPatchCheckResult();
                
                patchCheckSubmitBtn.disabled = false;
                patchCheckSubmitBtn.innerHTML = '<i class="fa fa-check-circle mr-2"></i>开始检查';
                showNotification('成功', '检查完成！', 'success');
            } else if (task_status === 'error' || (status && status.startsWith('error:'))) {
                clearInterval(patchCheckProgressInterval);
                patchCheckStatusText.textContent = '错误: ' + (data.error || status?.substring(7) || '未知错误');
                patchCheckSubmitBtn.disabled = false;
                patchCheckSubmitBtn.innerHTML = '<i class="fa fa-check-circle mr-2"></i>开始检查';
                showNotification('错误', data.error || status?.substring(7) || '未知错误', 'error');
            } else {
                const percentage = total > 0 ? Math.round((processed / total) * 100) : 0;
                patchCheckProgressBar.style.width = percentage + '%';
                patchCheckProgressText.textContent = percentage + '%';
                
                // 根据状态显示不同的文本
                let statusDisplay = '处理中...';
                if (status === 'initializing') {
                    statusDisplay = '正在初始化...';
                } else if (status === 'extracting_zip') {
                    statusDisplay = '正在提取压缩包...';
                } else if (status === 'checking') {
                    statusDisplay = '正在检查文件...';
                } else if (status === 'collecting_jar') {
                    statusDisplay = '正在收集JAR包文件...';
                } else if (status === 'starting') {
                    statusDisplay = '准备开始...';
                }
                
                patchCheckStatusText.textContent = statusDisplay;
                patchCheckCountText.textContent = `已处理: ${processed || 0} / ${total || 0}`;
            }
        }
        
        // 获取检查结果
        async function fetchPatchCheckResult() {
            try {
                const response = await fetch(`/patch-check/result/${patchCheckTaskId}`);
                const data = await response.json();
                
                if (!response.ok) {
                    throw new Error(data.error || '获取结果失败');
                }
                
                displayPatchCheckResult(data);
            } catch (error) {
                console.error('获取结果错误:', error);
                showNotification('错误', '获取检查结果失败', 'error');
            }
        }
        
        // 显示检查结果
        function displayPatchCheckResult(data) {
            const { results, summary } = data;
            
            // 显示统计信息
            patchCheckSummary.innerHTML = `
                <div class="p-4 bg-blue-50 rounded-lg border border-blue-100">
                    <p class="text-sm text-gray-600 mb-1">总文件数</p>
                    <p class="text-2xl font-bold text-blue-600">${summary.total}</p>
                </div>
                <div class="p-4 bg-green-50 rounded-lg border border-green-100">
                    <p class="text-sm text-gray-600 mb-1">JAR中存在</p>
                    <p class="text-2xl font-bold text-green-600">${summary.jar_exists}</p>
                </div>
                <div class="p-4 bg-purple-50 rounded-lg border border-purple-100">
                    <p class="text-sm text-gray-600 mb-1">压缩包中存在</p>
                    <p class="text-2xl font-bold text-purple-600">${summary.zip_exists}</p>
                </div>
                <div class="p-4 bg-yellow-50 rounded-lg border border-yellow-100">
                    <p class="text-sm text-gray-600 mb-1">内容一致</p>
                    <p class="text-2xl font-bold text-yellow-600">${summary.content_match}</p>
                </div>
            `;
            
            // 显示结果表格
            patchCheckResultTbody.innerHTML = '';
            results.forEach(result => {
                const row = document.createElement('tr');
                
                // 根据状态设置行样式
                let rowClass = '';
                let statusClass = '';
                if (result['状态'] === '一致') {
                    rowClass = 'bg-green-50';
                    statusClass = 'text-green-600 font-medium';
                } else if (result['状态'] === '不一致') {
                    rowClass = 'bg-red-50';
                    statusClass = 'text-red-600 font-medium';
                } else if (result['状态'] === '缺失') {
                    rowClass = 'bg-gray-50';
                    statusClass = 'text-gray-600 font-medium';
                } else if (result['状态'] === '部分缺失') {
                    rowClass = 'bg-yellow-50';
                    statusClass = 'text-yellow-600 font-medium';
                }
                
                row.className = rowClass;
                row.innerHTML = `
                    <td class="px-4 py-3 whitespace-nowrap text-sm text-gray-900">${result['lib包'] || '-'}</td>
                    <td class="px-4 py-3 text-sm text-gray-900">${result['路径'] || '-'}</td>
                    <td class="px-4 py-3 whitespace-nowrap text-sm text-gray-900">${result['文件名'] || '-'}</td>
                    <td class="px-4 py-3 whitespace-nowrap text-sm ${statusClass}">${result['状态'] || '-'}</td>
                    <td class="px-4 py-3 text-sm text-gray-900">${result['消息'] || '-'}</td>
                    <td class="px-4 py-3 whitespace-nowrap text-sm text-center">
                        ${result['jar中存在'] ? '<i class="fa fa-check text-green-600"></i>' : '<i class="fa fa-times text-red-600"></i>'}
                    </td>
                    <td class="px-4 py-3 whitespace-nowrap text-sm text-center">
                        ${result['zip中存在'] ? '<i class="fa fa-check text-green-600"></i>' : '<i class="fa fa-times text-red-600"></i>'}
                    </td>
                    <td class="px-4 py-3 whitespace-nowrap text-sm text-center">
                        ${result['内容一致'] ? '<i class="fa fa-check text-green-600"></i>' : '<i class="fa fa-times text-red-600"></i>'}
                    </td>
                `;
                patchCheckResultTbody.appendChild(row);
            });
            
            // 显示结果容器
            patchCheckResultContainer.classList.remove('hidden');
            patchCheckResultContainer.scrollIntoView({ behavior: 'smooth' });
        }
    </script>
</body>
</html>